package com.jpush.visitor;

import com.jpush.adapter.LogAdapter;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

public class LogVisitor extends ClassVisitor {
    public LogVisitor(int api, ClassWriter classWriter) {
        super(api,classWriter);
    }

    @Override
    public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
        MethodVisitor methodVisitor = cv.visitMethod(access, name, descriptor, signature, exceptions);
        if (name.equals("show")){
//            int api, MethodVisitor mv, int access, String name, String desc
            methodVisitor = new LogAdapter(Opcodes.ASM7, methodVisitor, access, name, descriptor);
        }
        return methodVisitor;
    }
}
